home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / il / ilSharpenKernel.z / ilSharpenKernel
Encoding:
Text File  |  2002-10-03  |  10.2 KB  |  265 lines

  1.  
  2.  
  3.  
  4. iiiillllSSSShhhhaaaarrrrppppeeeennnnKKKKeeeerrrrnnnneeeellll((((3333))))                    IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      iiiillllSSSShhhhaaaarrrrppppeeeennnnKKKKeeeerrrrnnnneeeellll - a kernel to do image sharpening (and blurring)
  10.  
  11. IIIINNNNHHHHEEEERRRRIIIITTTTSSSS FFFFRRRROOOOMMMM
  12.      ilWatchedObject : ilKernel
  13.  
  14. HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
  15.      #include <il/ilSharpenKernel.h>
  16.  
  17.  
  18. CCCCLLLLAAAASSSSSSSS DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  19.      This class implements a 2D gaussian shaped image sharpening (or blurring
  20.      kernel).  The type of sharpening performed is typically called unsharp
  21.      masking, and results from a weighted subtraction of a blurred version of
  22.      the image from the original.  The filter weights are detemined by the
  23.      formula:
  24.  
  25.                        2    2              2        2
  26.                 -( ( dx + dy ) / (2 * sigma * radius ) )
  27.               e
  28.  
  29.      where:
  30.  
  31.               dx = x distance from center of kernel
  32.               dy = y distance from center of kernel
  33.  
  34.  
  35.      This creates a circularly symmetric, Gaussian shapped kernel.  The filter
  36.      weights are then normalized to produce an output that computes:
  37.  
  38.               (1+sharpness)*I - sharpness*G
  39.  
  40.      where I is the original image G is the orignal image with the gausing
  41.      kernel applied.
  42.  
  43.      Here are some example kernels with the default sharpness factor, 0.5, for
  44.      various radii:
  45.  
  46.                                    -.00002   -.0006   -.0020   -.0006   -.00002
  47.    -.00006   -.0053   -.00006      -.0006    -.0189   -.0581   -.0189   -.0006
  48.    -.0053    1.0215   -.0053       -.0020    -.0581   1.3210   -.0581   -.0020
  49.    -.00006   -.0053   -.00006      -.0006    -.0189   -.0581   -.0189   -.0006
  50.                                    -.00002   -.0013   -.0020   -.0013   -.00002
  51.  
  52.            rrrraaaaddddiiiiuuuussss ==== 1111                               rrrraaaaddddiiiiuuuussss ==== 2222
  53.  
  54.      The default kernel is:
  55.  
  56.                              -.0057   -.0419   -.0057
  57.                              -.0419   1.1903   -.0419
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. iiiillllSSSShhhhaaaarrrrppppeeeennnnKKKKeeeerrrrnnnneeeellll((((3333))))                    IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll
  71.  
  72.  
  73.  
  74.                              -.0057   -.0419   -.0057
  75.  
  76.                                    rrrraaaaddddiiiiuuuussss ==== 1111....5555
  77.  
  78.      The kernel weights always sum to one and the clamping attribute is set on
  79.      this kernel so no change in the input range of values will be effected by
  80.      the application of this kernel.
  81.  
  82.  
  83. CCCCLLLLAAAASSSSSSSS MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN SSSSUUUUMMMMMMMMAAAARRRRYYYY
  84.      CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrr
  85.  
  86.           ilSharpenKernel(float sharpness=.5, float radius=1.5)
  87.  
  88.      GGGGeeeetttt aaaannnndddd sssseeeetttt sssshhhhaaaarrrrppppeeeennnniiiinnnngggg ppppaaaarrrraaaammmmeeeetttteeeerrrrssss
  89.  
  90.           void setSharpness(float val)
  91.           void setRadius(float val)
  92.           void setSigma(float val)
  93.           float getSharpness()
  94.           float getRadius()
  95.           float getSigma()
  96.  
  97.  
  98. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
  99.      iiiillllSSSShhhhaaaarrrrppppeeeennnnKKKKeeeerrrrnnnneeeellll(((())))
  100.  
  101.           ilSharpenKernel(float sharpness=.5, float radius=1.5)
  102.  
  103.  
  104.           Creates a kernel with the specified _s_h_a_r_p_n_e_s_s and _r_a_d_i_u_s.  The
  105.           sharpness typically ranges from -1 for maximum blur, to 0 for no
  106.           effect, to positive values up to about 10 for various degrees of
  107.           sharpening.  The radius can be any non-negative value.  A radius of
  108.           zero will perform no filtering, while successively larger values
  109.           will filter lower and lower frequencies.  The actual kernel size is
  110.           determined by the formula:
  111.  
  112.               width,height = 1 + 2*(int)radius
  113.  
  114.  
  115.           Thus, a radius of 1.5 (the default) will create a 3x3 kernel.
  116.  
  117.      ggggeeeettttRRRRaaaaddddiiiiuuuussss(((())))
  118.  
  119.           float getRadius()
  120.  
  121.  
  122.           This method returns the current radius of the filter as set by the
  123.           constructor or the last call to sssseeeettttRRRRaaaaddddiiiiuuuussss().
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. iiiillllSSSShhhhaaaarrrrppppeeeennnnKKKKeeeerrrrnnnneeeellll((((3333))))                    IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll
  137.  
  138.  
  139.  
  140.      ggggeeeettttSSSShhhhaaaarrrrppppnnnneeeessssssss(((())))
  141.  
  142.           float getSharpness()
  143.  
  144.  
  145.           This method returns the current sharpness of the filter as set by
  146.           the constructor or the last call to sssseeeettttSSSShhhhaaaarrrrppppnnnneeeessssssss().
  147.  
  148.      ggggeeeettttSSSSiiiiggggmmmmaaaa(((())))
  149.  
  150.           float getSigma()
  151.  
  152.  
  153.           This method returns the sigma value used in generating the kernel
  154.           (see the equation above).
  155.  
  156.      sssseeeettttRRRRaaaaddddiiiiuuuussss(((())))
  157.  
  158.           void setRadius(float val)
  159.  
  160.  
  161.           This method sets the radius of the kernel to _v_a_l.  The radius can be
  162.           any non-negative value. A radius of zero will perform no filtering,
  163.           while successively larger values will filter lower and lower
  164.           frequencies.  The actual kernel size is determined by the formula:
  165.  
  166.               width,height = 1 + 2*(int)radius
  167.  
  168.  
  169.           If any objects are watching this kernel (see iiiillllWWWWaaaattttcccchhhheeeeddddOOOObbbbjjjjeeeecccctttt(3))
  170.           then they will be notified that the kernel has changed when this
  171.           method is called.
  172.  
  173.      sssseeeettttSSSShhhhaaaarrrrppppnnnneeeessssssss(((())))
  174.  
  175.           void setSharpness(float val)
  176.  
  177.  
  178.           This method sets the sharpness of the kernel to _v_a_l.  The effect of
  179.           the sharpness value falls into three ranges: positve, between 0 and
  180.           -1, and less than -1.  As the value increases from zero the result
  181.           is a progressively more sharpended image, typically values from 0-10
  182.           are used. Values larger than about 2 produce a fairly extreme
  183.           sharpening effect.  As the value decreases from zero going to -1 the
  184.           result is a progressively more blurry image.  Values less than -1
  185.           produce a weird effect that becomes progressively sharper; this
  186.           range is not normally used.
  187.  
  188.           If any objects are watching this kernel (see iiiillllWWWWaaaattttcccchhhheeeeddddOOOObbbbjjjjeeeecccctttt(3))
  189.           then they will be notified that the kernel has changed when this
  190.           method is called.
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. iiiillllSSSShhhhaaaarrrrppppeeeennnnKKKKeeeerrrrnnnneeeellll((((3333))))                    IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll
  203.  
  204.  
  205.  
  206.      sssseeeettttSSSSiiiiggggmmmmaaaa(((())))
  207.  
  208.           void setSigma(float val)
  209.  
  210.  
  211.           This method sets the sigma value used in generating the kernel (see
  212.           the equation above).  The default value is 1/3.  The useful range is
  213.           from zero to one.
  214.  
  215. IIIINNNNHHHHEEEERRRRIIIITTTTEEEEDDDD MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS
  216.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm iiiillllKKKKeeeerrrrnnnneeeellll
  217.      calcGain(), calcPassGain(), copy(), getData(), getDataType(),
  218.      getElement(), getKernelType(), getOrigin(), getSize(), getVal(),
  219.      getXsize(), getYsize(), getZsize(), init(), isClampSet(), isEquivalent(),
  220.      offset(), offset(), operator=(), scale(), setClamp(), setData(),
  221.      setElement(), setOrigin(), setVal()
  222.  
  223.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm iiiillllWWWWaaaattttcccchhhheeeeddddOOOObbbbjjjjeeeecccctttt
  224.      addWatchCallback(), doWatchCallbacks(), removeWatchCallback()
  225.  
  226. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  227.      ilWatchedObject, ilKernel, ilSepShapenKernel
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.